// 分类管理
import requset from '@/utils/request'

// 获取分类列表
export function getfenleiList(params) {
  return requset({
    url: '/categories',
    method: 'get',
    params
  })
}

// 获取分类数量
export function getfenleiNum(params) {
  return requset({
    url: '/categories/count',
    method: 'get',
    params
  })
}

// 删除分类
export function delfenlei(id) {
  return requset({
    url: `/categories/${id}`,
    method: 'delete'
  })
}

// 新增分类
export function addfenlei(data) {
  return requset({
    url: '/categories',
    method: 'post',
    data
  })
}

// 获取单个分类
export function onefenlei(id) {
  return requset({
    url: `/categories/${id}`,
    method: 'get'
  })
}

// 编辑分类
export function editfenlei(data) {
  return requset({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}
